/**
 * 
 */
package edu.scsu.csci.validator;

import java.util.Date;

import edu.scsu.csci.IValidator;
import edu.scsu.csci.annotation.validator.ADateValidator;


/**
 *
 * @author Maqbool Khan
 * @since jdk 1.5
 * @see
 */
final public class DateValidator implements IValidator<ADateValidator, Date>	{

	/**
	 * <p>Validates the passed Integer object based on the validator annotaion passesd.
	 * 
	 * @param annotation
	 * @param object
	 * @throws ValidationException 
	 */
	public void validate(ADateValidator annotation, Date date) throws ValidationException {
		if( isNull(annotation, date)){
			throw new ValidationException("field cannot be null");
		}
		/*if(isIllegalValue(annotation, date)){
			WebUtils.setErrorMessage("field is of illegal value");
		}*/
	}
	
	/**
	 * Returns true if the null is not an acceptable value
	 *  and the passed long object is null. 
	 * 
	 * @param annotation
	 * @param string
	 * @return
	 */
	private boolean isNull(ADateValidator annotation, Date date){
		return annotation.isNullAllowed() ? false : date == null;
	}
		
	/**
	 * Returns true if the string of any other length than specified by the
	 * validator annotation.
	 * 
	 * @param annotation
	 * @param string
	 * @return
	 *//*
	private boolean isIllegalValue(ADateValidator annotation, Date date){
		return date.after(annotation.max())
	}*/
}
